package lumis.service.seo.robotstxt;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import lumis.portal.event.persistence.PortalEventEntityListener;

import org.hibernate.annotations.GenericGenerator;


/**
 * @version $Revision: 10825 $ $Date: 2009-08-04 12:36:40 -0300 (Tue, 04 Aug 2009) $
 * @since 5.0.0
 */
@Entity
@Table(name="lum_RbtsUserAgent")
@GenericGenerator(name="portal-guid", strategy="lumis.portal.dao.hibernate.GuidGenerator")
@EntityListeners(value=PortalEventEntityListener.class)
public class UserAgent
{
	
	@Id @GeneratedValue(generator="portal-guid")
	private String id;
	
	private Integer crawlDelay;
	
	private String requestRate;
	
	private String userAgent;
	
	private String visitTime;
	
	@OneToMany(mappedBy="userAgent", cascade=CascadeType.ALL)
	@OrderBy(value="value,type")
	private List<UserAgentPermission> permissions = new ArrayList<UserAgentPermission>();

	
	
	/**
	 * Returns the permissions.
	 * @return the permissions
	 * @since 5.0.0
	 */
	public List<UserAgentPermission> getPermissions()
	{

		return permissions;
	}
	
	/**
	 * Sets the permissions.
	 * @param permissions the permissions value to set.
	 * @since 5.0.0
	 */
	public void setPermissions(List<UserAgentPermission> permissions)
	{
		this.permissions = permissions;
	}
	/**
	 * Returns the id.
	 * @return the id
	 * @since 5.0.0
	 */
	public String getId()
	{
		return id;
	}
	/**
	 * Sets the id.
	 * @param id the id value to set.
	 * @since 5.0.0
	 */
	public void setId(String id)
	{
		this.id = id;
	}
	
	/**
	 * Returns the crawlDelay.
	 * @return the crawlDelay
	 * @since 5.0.0
	 */
	public Integer getCrawlDelay()
	{
		return crawlDelay;
	}

	/**
	 * Sets the crawlDelay.
	 * @param crawlDelay the crawlDelay value to set.
	 * @since 5.0.0
	 */
	public void setCrawlDelay(Integer crawlDelay)
	{
		this.crawlDelay = crawlDelay;
	}

	/**
	 * Returns the requestRate.
	 * @return the requestRate
	 * @since 5.0.0
	 */
	public String getRequestRate()
	{
		return requestRate;
	}
	/**
	 * Sets the requestRate.
	 * @param requestRate the requestRate value to set.
	 * @since 5.0.0
	 */
	public void setRequestRate(String requestRate)
	{
		this.requestRate = requestRate;
	}
	/**
	 * Returns the userAgent.
	 * @return the userAgent
	 * @since 5.0.0
	 */
	public String getUserAgent()
	{
		return userAgent;
	}
	/**
	 * Sets the userAgent.
	 * @param userAgent the userAgent value to set.
	 * @since 5.0.0
	 */
	public void setUserAgent(String userAgent)
	{
		this.userAgent = userAgent;
	}
	/**
	 * Returns the visitTime.
	 * @return the visitTime
	 * @since 5.0.0
	 */
	public String getVisitTime()
	{
		return visitTime;
	}
	/**
	 * Sets the visitTime.
	 * @param visitTime the visitTime value to set.
	 * @since 5.0.0
	 */
	public void setVisitTime(String visitTime)
	{
		this.visitTime = visitTime;
	}

}
